<template>
	<div class="bigDiv">
		<!-- 项目表单 -->
		<el-form :inline="true" label-width="100px">
			<div class="topNav">
				<el-button type="text" icon="el-icon-search" @click="getList" style="float:right;">搜索</el-button>
				<el-button type="text" icon="el-icon-refresh" @click="reset"
					style="float:right;margin-right:10px;">重置</el-button>
				<el-button type="text" icon="el-icon-plus" @click="editProduct('','')">新建项目</el-button>
			</div>
			<el-form-item label="时间" prop="time">
				<el-date-picker v-model="timeModel" type="daterange" range-separator="至" start-placeholder="开始日期"
					end-placeholder="结束日期" value-format="yyyy-MM-dd hh:mm:ss" size="small">
				</el-date-picker>
			</el-form-item>
			<el-form-item label="项目状态">
				<el-select size="small" v-model="queryParams.projectStatus" placeholder="请选择状态" filterable clearable>
					<el-option v-for="item in stateList" :label="item.dictLabel" :value="item.dictValue">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="优先级">
				<el-select size="small" v-model="queryParams.level" placeholder="请选择状态" filterable clearable>
					<el-option value="低" label="低"></el-option>
					<el-option value="中" label="中"></el-option>
					<el-option value="高" label="高"></el-option>
					<el-option value="紧急" label="紧急"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="关联产品" prop="productNo">
				<el-select filterable v-model="queryParams.productNo" size="small">
					<el-option :value="item.productNo" :label="item.productName"
						v-for="item in productList"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="负责人" prop="adminUser">
				<el-select filterable v-model="queryParams.adminUser" size="small">
					<el-option :value="item.id" :label="item.name" v-for="item in userList"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="项目名称">
				<el-input v-model="queryParams.projectName" placeholder="项目名称" clearable size="small"
					@keyup.enter.native="getList" />
			</el-form-item>
		</el-form>
		<!-- 项目列表 -->
		<el-table v-loading="loading" :data="list" border height="calc(100vh - 380px)">
			<el-table-column label="项目编号" align="center" prop="projectNo" fixed="left" width="200"></el-table-column>
			<el-table-column label="状态" align="center" prop="projectStatusStr" width="200"></el-table-column>
			<el-table-column label="项目名称" align="center" prop="projectName" width="200"></el-table-column>
			<el-table-column label="负责人" align="center" prop="adminUserStr"></el-table-column>
			<el-table-column label="关联产品" align="center" prop="productName" width="200"></el-table-column>
			<el-table-column label="项目类别" align="center" prop="projectTypeStr" width="200"></el-table-column>
			<el-table-column label="优先级" align="center" prop="level" width="200"></el-table-column>
			<el-table-column label="创建时间" align="center" prop="createTime" width="200"></el-table-column>
			<el-table-column label="创建人" align="center" prop="createUserName" width="200"></el-table-column>
			<!-- <el-table-column label="更新时间" align="center" prop="updateTime" width="200"></el-table-column>
			<el-table-column label="更新人" align="center" prop="updateUser" width="200"></el-table-column> -->
			<el-table-column label="操作" align="center" width="250" fixed="right">
				<template slot-scope="scope">
					<el-button type="text" size="mini" class="editBtn" @click="editProduct(scope.row,'')"
						v-if="scope.row.projectStatusStr == '工单创建'">
						编辑
					</el-button>
					<el-button type="text" size="mini" class="deleteBtn" @click="deleteProduct(scope.row)"
						v-if="scope.row.projectStatusStr == '工单创建' && userId == scope.row.createUser">
						删除
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="lookProduct(scope.row)">
						详情
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="operate(scope.row,'yunying')"
						v-if="scope.row.projectStatusStr == '工单创建' && code == 'operate'">
						运营确认
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="operate(scope.row,'technology')"
						v-if="scope.row.projectStatusStr == '业务功能点梳理' && code == 'coder'">
						技术反馈
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="editProduct(scope.row,1)"
						v-if="scope.row.projectStatusStr == '审批完成' && code == 'coder'">
						技术分配任务
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="print(scope.row,1)"
					 v-if="scope.row.projectStatusStr == '技术分配任务' || scope.row.projectStatusStr == '审批完成' || scope.row.projectStatusStr.indexOf('验收') > -1
					 || scope.row.projectStatusStr.indexOf('等待验收') > -1">
						工单打印
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="CheckOrder(scope.row,'WAIT_CHECK')"
						v-if="scope.row.projectStatusStr == '测试' && code == 'coder' && userId == scope.row.adminUser">
						提交验收
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="CheckOrder(scope.row,'CHECK')"
						v-if="scope.row.projectStatusStr == '等待验收' && userId == scope.row.createUser">
						验收
					</el-button>
					<el-button type="text" size="mini" class="detailBtn" @click="sendApply(scope.row,1)" v-if="scope.row.projectStatusStr == '技术回复业务功能点'">
						发起审批
					</el-button>
				</template>
			</el-table-column>
		</el-table>
		<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
			:limit.sync="queryParams.pageSize" @pagination="getList" />

		<!-- 项目维护弹窗 -->
		<el-dialog title="项目维护" :visible.sync="productModel" :close-on-click-modal="false"
			:close-on-press-escape="false" width="80%">
			<el-form ref="programForm" :model="programForm" label-width="100px" :rules="rules">
				<el-row>
					<el-col :span="12">
						<el-form-item label="项目名称" prop="projectName">
							<el-input v-model="programForm.projectName" placeholder="请输入项目名称"
								:disabled="dealType == 'change'"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="项目类型" prop="projectType">
							<el-select filterable v-model="programForm.projectType" :disabled="dealType == 'change'">
								<el-option :value="item.dictValue" :label="item.dictLabel"
									v-for="item in projectTypeList"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="关联产品" prop="productNo">
							<el-select filterable v-model="programForm.productNo" :disabled="dealType == 'change'">
								<el-option :value="item.productNo" :label="item.productName"
									v-for="item in productList"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="优先级" prop="level">
							<el-select filterable v-model="programForm.level">
								<el-option value="低" label="低"></el-option>
								<el-option value="中" label="中"></el-option>
								<el-option value="高" label="高"></el-option>
								<el-option value="紧急" label="紧急"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="12">
						<el-form-item label="希望交期" prop="time">
							<el-date-picker v-model="programForm.time" type="daterange"
								range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
								value-format="yyyy-MM-dd hh:mm:ss" style="width:100%;">
							</el-date-picker>
						</el-form-item>
					</el-col> -->
				</el-row>
				<el-row>
					<el-form-item label="项目描述" prop="projectDesc">
						<el-input type="textarea" v-model="programForm.projectDesc" placeholder="请输入描述" maxlength="1000"
							:disabled="dealType == 'change'" show-word-limit></el-input>
					</el-form-item>
				</el-row>
				<!-- <el-row>
					<el-col :span="24">
						<el-form-item label="附件上传" prop="time">
							<el-upload action="https://jsonplaceholder.typicode.com/posts/">
								<el-button type="primary" size="mini">附件上传</el-button>
							</el-upload>
							<a style="margin-right:20px;cursor:pointer;text-decoration:underline;color:blue;">附件1</a>
							<a style="margin-right:20px;cursor:pointer;text-decoration:underline;color:blue;">附件2</a>
							<a style="margin-right:20px;cursor:pointer;text-decoration:underline;color:blue;">附件3</a>
						</el-form-item>
					</el-col>
				</el-row> -->
				<el-row v-if="dealType == 'change'">
					<el-col :span="12">
						<el-form-item label="负责人" prop="adminUser">
							<el-select filterable v-model="programForm.adminUser">
								<el-option :value="item.id" :label="item.name" v-for="item in userList"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="12">
						<el-form-item label="项目成员" prop="code">
							<el-select filterable multiple v-model="programForm.collaborator">
								<el-option value="李越" label="李越"></el-option>
								<el-option value="霍东博" label="霍东博"></el-option>
							</el-select>
						</el-form-item>
					</el-col> -->
				</el-row>
				<!-- 此部分需工单审批通过后技术创建 -->
				<el-form-item label="需求功能点" prop="describe" v-if="dealType == 'change'">
					<table class="table">
						<tr>
							<td width="5%">序号</td>
							<td width="15%">需求功能点</td>
							<td width="20%">负责人</td>
							<td width="30%">成员</td>
							<td width="30%">周期</td>
							<!-- <td width="10%">操作</td> -->
						</tr>
						<tr v-for="(item,index) in technologyTimeList">
							<td>{{index+1}}</td>
							<td>
								{{item.projectFunc}}
								<!-- <el-select filterable v-model="technologyTimeList[index].state" size="mini"  :value="technologyTimeList[index].id"
									style="float: left;">
									<el-option :value="item.id" :label="item.projectFunc"
										v-for="item in technologyTimeList"></el-option>
								</el-select> -->
							</td>
							<td>
								<el-select filterable v-model="technologyTimeList[index].adminUser" size="mini">
									<el-option :value="item.id" :label="item.name" v-for="item in userList"></el-option>
								</el-select>
							</td>
							<td>
								<el-select filterable multiple v-model="technologyTimeList[index].collaborator"
									size="mini">
									<el-option :value="item.id" :label="item.name" v-for="item in userList"></el-option>
								</el-select>
							</td>
							<td>
								<el-date-picker v-model="technologyTimeList[index].timeModel" type="daterange"
									range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
									value-format="yyyy-MM-dd hh:mm:ss" size="mini" style="width:100%;">
								</el-date-picker>
							</td>
							<!-- <td>
								<el-button size="mini" @click="deleteRow(index)">删除</el-button>
							</td> -->
						</tr>
					</table>
					<!-- <el-button @click="addRow()" size="mini" type="primary">添加阶段</el-button> -->
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="productModel = false">取 消</el-button>
				<el-button type="primary" @click="submitProduct()">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 详情 -->
		<el-dialog title="详情" :visible.sync="detailModel" :close-on-click-modal="false" :close-on-press-escape="false"
			width="90%">
			<el-tabs :tab-position="tabPosition" @tab-click="tabClicks">
				<!-- 项目概述 -->
				<el-tab-pane label="项目概述">
					<div>
						<el-form ref="detailForm" :model="detailForm" label-width="100px" :rules="rules">
							<el-row>
								<!-- {{detailForm}} -->
								<el-col :span="8">
									<el-form-item label="项目名称" prop="projectName">
										<el-input v-model="detailForm.projectName" placeholder="请输入项目名称"
											disabled></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="8">
									<el-form-item label="负责人" prop="adminUserStr">
										<el-input v-model="detailForm.adminUserStr" placeholder="请输入项目负责人"
											disabled></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="8">
									<el-form-item label="关联产品" prop="product">
										<el-select filterable v-model="detailForm.productNo" disabled>
											<el-option :value="item.productNo" :label="item.productName"
												v-for="item in productList"></el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<el-col :span="8">
									<el-form-item label="优先级" prop="level">
										<el-select filterable v-model="detailForm.level" disabled>
											<el-option value="低" label="低"></el-option>
											<el-option value="中" label="中"></el-option>
											<el-option value="高" label="高"></el-option>
											<el-option value="紧急" label="紧急"></el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<!-- <el-col :span="8">
									<el-form-item label="计划完成周期" prop="time">
										<el-date-picker v-model="timeModel" type="daterange" range-separator="至"
											start-placeholder="开始日期" end-placeholder="结束日期"
											value-format="yyyy-MM-dd hh:mm:ss" disabled>
										</el-date-picker>
									</el-form-item>
								</el-col> -->
								<!-- <el-col :span="8">
									<el-form-item label="负责人" prop="manager">
										<el-select filterable v-model="detailForm.manager" disabled>
											<el-option value="李越" label="李越"></el-option>
											<el-option value="霍东博" label="霍东博"></el-option>
										</el-select>
									</el-form-item>
								</el-col> -->
								<!-- <el-col :span="8">
									<el-form-item label="项目成员" prop="collaborator">
										<el-select filterable multiple v-model="detailForm.collaborator" disabled>
											<el-option value="李越" label="李越"></el-option>
											<el-option value="霍东博" label="霍东博"></el-option>
										</el-select>
									</el-form-item>
								</el-col> -->
							</el-row>
							<el-form-item label="项目描述" prop="projectDesc">
								<el-input type="textarea" v-model="detailForm.projectDesc" placeholder="请输入描述"
									maxlength="1000" disabled show-word-limit></el-input>
							</el-form-item>
							<!-- <el-form-item label="附件" prop="describe">
								<a
									style="margin-right:20px;cursor:pointer;text-decoration:underline;color:blue;">附件1</a>
								<a
									style="margin-right:20px;cursor:pointer;text-decoration:underline;color:blue;">附件2</a>
								<a
									style="margin-right:20px;cursor:pointer;text-decoration:underline;color:blue;">附件3</a>
							</el-form-item> -->



							<el-form-item label="需求功能点" prop="describe">
								<table class="table">
									<tr>
										<td width="5%">序号</td>
										<td width="25%">需求功能点</td>
										<td width="20%">负责人</td>
										<td width="20%">成员</td>
										<td width="30%">周期</td>
										<!-- <td width="10%">操作</td> -->
									</tr>
									<tr v-for="(item,index) in technologyTimeList">
										<td>{{index+1}}</td>
										<td>
											<el-select filterable v-model="technologyTimeList[index].state" size="mini"
												disabled style="float: left;">
												<el-option :value="item.id" :label="item.projectFunc"
													v-for="item in technologyTimeList"></el-option>
											</el-select>
										</td>
										<td>
											<el-select filterable v-model="technologyTimeList[index].adminUser"
												size="mini" disabled>
												<el-option :value="item.id" :label="item.name"
													v-for="item in userList"></el-option>
											</el-select>
										</td>
										<td>
											<el-select filterable multiple
												v-model="technologyTimeList[index].collaborator" size="mini" disabled>
												<el-option :value="item.id" :label="item.name"
													v-for="item in userList"></el-option>
											</el-select>
										</td>
										<td>
											<el-date-picker v-model="technologyTimeList[index].timeModel"
												type="daterange" range-separator="至" start-placeholder="开始日期"
												end-placeholder="结束日期" value-format="yyyy-MM-dd hh:mm:ss" size="mini"
												style="width:100%;" disabled>
											</el-date-picker>
										</td>
										<!-- <td>
											<el-button size="mini" @click="deleteRow(index)">删除</el-button>
										</td> -->
									</tr>
								</table>
							</el-form-item>
						</el-form>
					</div>
				</el-tab-pane>
				<el-tab-pane label="项目任务">
					<el-table v-loading="loading" :data="technologyTimeList" border height="calc(100vh - 320px)">
						<el-table-column label="任务编号" align="center" prop="missionNo" fixed="left"
							width="200"></el-table-column>
						<el-table-column label="任务状态" align="center" prop="missionStateLabel"
							width="200"></el-table-column>
						<!-- <el-table-column label="完成进度" align="center" prop="process" width="200"></el-table-column> -->
						<!-- <el-table-column label="类型" align="center" prop="type" width="200"></el-table-column> -->
						<!-- <el-table-column label="任务主题" align="center" prop="orderName" width="200"></el-table-column> -->
						<el-table-column label="关联功能点" align="center" prop="projectFunc" width="200"></el-table-column>
						<el-table-column label="负责人" align="center" prop="adminUserName" width="200"></el-table-column>
						<el-table-column label="协作人" align="center" prop="collaborator" width="200">
							<template slot-scope="scope">{{scope.row.collaboratorName.join(",")}}</template>
						</el-table-column>
						<!-- <el-table-column label="工作类型" align="center" prop="workType" width="200"></el-table-column> -->
						<el-table-column label="开始时间" align="center" prop="startTime" width="200"></el-table-column>
						<el-table-column label="结束时间" align="center" prop="endTime" width="200"></el-table-column>
						<el-table-column label="预估工时" align="center" prop="preOrderTime" width="200">
							<template
								slot-scope="scope">{{(new Date(scope.row.endTime).getTime() - new Date(scope.row.startTime).getTime()) / 1000 / 60 / 60 / 24 }}</template>
						</el-table-column>
					</el-table>
				</el-tab-pane>
				<el-tab-pane label="项目文档">
					<el-upload :action="fileUrl" :headers="fileHeaders" :show-file-list="false" :file-list="fileList"
						type="doc"
						:on-success="(res, file, fileList) => handleAvatarSuccess(res, file, fileList, 'DOC')"
						:on-error="handleAvatarError" multiple :limit="10000">
						<el-button type="primary" size="mini" style="margin:20px;">新建文档</el-button>
					</el-upload>
					<el-table v-loading="loading" :data="fileList" border height="calc(100vh - 320px)">
						<el-table-column label="文档名称" align="center" prop="fileName" fixed="left"></el-table-column>
						<el-table-column label="文档类型" align="center" prop="fileType">
							<template slot-scope="scope">
								{{scope.row.fileType == 'BUSINESS'?'业务梳理功能点':''}}
								{{scope.row.fileType == 'TECHNOLOGY'?'技术功能点':''}}
								{{scope.row.fileType == 'DOC'?'项目文档':''}}
							</template>
						</el-table-column>
						<el-table-column label="创建人" align="center" prop="createUserName"></el-table-column>
						<el-table-column label="创建时间" align="center" prop="createTime"></el-table-column>
						<el-table-column label="操作" align="center" width="150" fixed="right">
							<template slot-scope="scope">
								<el-button type="text" size="mini" class="editBtn"
									@click="downLoadProjectFile(scope.row)">
									下载
								</el-button>
								<el-button type="text" size="mini" class="deleteBtn"
									@click="deleteProjectFile(scope.row)">
									删除
								</el-button>
							</template>
						</el-table-column>
					</el-table>
				</el-tab-pane>
				<!-- <el-tab-pane label="工作记录">
					<el-form :inline="true" label-width="100px" styel="overflow:hidden;">
						<div class="topNav">
							<el-button type="text" icon="el-icon-search" @click="getList"
								style="float:right;">搜索</el-button>
							<el-button type="text" icon="el-icon-refresh" @click="reset"
								style="float:right;margin-right:10px;">重置</el-button>
						</div>
						<el-form-item label="选择人员" prop="manager">
							<el-select filterable multiple v-model="programForm.manager">
								<el-option value="李越" label="李越"></el-option>
								<el-option value="霍东博" label="霍东博"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item label="工作内容">
							<el-input v-model="programForm.project" placeholder="工作内容" clearable size="small"
								@keyup.enter.native="getList" />
						</el-form-item>
					</el-form>
					<el-table v-loading="loading" :data="projectLogList" border height="calc(100vh - 320px)">
						<el-table-column label="任务编号" align="center" prop="orderNo" fixed="left"
							width="200"></el-table-column>
						<el-table-column label="工作时间范围" align="center" prop="timeRange" width="200"></el-table-column>
						<el-table-column label="工时" align="center" prop="workTime" width="200"></el-table-column>
						<el-table-column label="工作类型" align="center" prop="workType" width="200"></el-table-column>
						<el-table-column label="工作内容" align="center" prop="taskName" width="200"></el-table-column>
						<el-table-column label="执行员工" align="center" prop="manager" width="200"></el-table-column>
						<el-table-column label="所在部门" align="center" prop="depart" width="200"></el-table-column>
						<el-table-column label="记录时间" align="center" prop="createTime" width="200"></el-table-column>
						<el-table-column label="操作" align="center" width="50" fixed="right">
							<template slot-scope="scope">
								<el-button type="text" size="mini" class="editBtn" @click="editWorkTime">
									修改
								</el-button>
							</template>
						</el-table-column>
					</el-table>
				</el-tab-pane> -->
				<!-- <el-tab-pane label="项目评论">项目评论</el-tab-pane> -->
				<el-tab-pane label="项目人员">
					<!-- {{projectUserList}} -->
					<!-- <el-button type="primary" size="mini" style="margin:20px;" @click="addPerson">新增项目成员</el-button> -->
					<el-table v-loading="loading" :data="projectUserList" border height="calc(100vh - 320px)">
						<el-table-column label="成员姓名" align="center" prop="name" fixed="left"></el-table-column>
						<!-- <el-table-column label="进入项目日期" align="center" prop="createTime" width="200"></el-table-column> -->
						<!-- <el-table-column label="角色" align="center" prop="post"></el-table-column> -->
						<!-- <el-table-column label="职位" align="center" prop="idtype" width="200"></el-table-column>
						<el-table-column label="所在部门" align="center" prop="depart" width="200"></el-table-column>
						<el-table-column label="手机号码" align="center" prop="mobile" width="200"></el-table-column>
						<el-table-column label="电子邮箱" align="center" prop="email" width="200"></el-table-column>
						<el-table-column label="状态" align="center" prop="status" width="200"></el-table-column>
						<el-table-column label="操作" align="center" width="100" fixed="right">
							<template slot-scope="scope">
								<el-button type="text" size="mini" class="editBtn">
									移除
								</el-button>
							</template>
						</el-table-column> -->
					</el-table>
				</el-tab-pane>
				<el-tab-pane label="项目动态">
					<el-timeline :reverse="true">
						<div style="height:400px;overflow-y:scroll;">
							<el-timeline-item v-for="item in projectLogList">
								<p>{{item.name}}</p>
								<p>于{{item.createTime}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;操作{{item.detail}}</p>
							</el-timeline-item>
						</div>
					</el-timeline>
				</el-tab-pane>
			</el-tabs>
			<span slot="footer" class="dialog-footer">
				<el-button @click="detailModel = false">关 闭</el-button>
			</span>
		</el-dialog>
		<el-dialog :visible.sync="personDialog" title="人员管理">
			<el-form ref="programForm" :model="programForm" label-width="100px" :rules="rules">
				<el-form-item label="选择人员" prop="manager">
					<el-select filterable multiple v-model="programForm.collaborator">
						<el-option value="李越" label="李越"></el-option>
						<el-option value="霍东博" label="霍东博"></el-option>
					</el-select>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="personDialog = false">关 闭</el-button>
			</span>
		</el-dialog>
		<el-dialog :visible.sync="documentDialog" title="文档管理">
			<el-form ref="programForm" :model="programForm" label-width="100px" :rules="rules">
				<center>
					<el-upload drag action="https://jsonplaceholder.typicode.com/posts/" multiple>
						<i class="el-icon-upload"></i>
						<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
					</el-upload>
				</center>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="documentDialog = false">关 闭</el-button>
			</span>
		</el-dialog>
		<el-dialog :visible.sync="operateDialog" title="运营技术功能点梳理确认" width="90%">
			<el-form ref="operateForm" :model="operateForm" class="pointForm">
				<el-form-item label="" prop="describe">
					<el-col :span="11">
						<table class="table">
							<tr>
								<td width="10%">序号</td>
								<td width="80%">运营梳理功能点</td>
								<td width="10%" v-if="operateType == 'yunying'">操作</td>
							</tr>
							<tr v-for="(item,index) in yunyingPointList">
								<td>
									{{index+1}}
								</td>
								<td style="padding:0px;">
									<el-input type="textarea" v-model="yunyingPointList[index].projectFunc"
										style="border:none;" placeholder="请输入梳理功能点"
										:disabled="operateType != 'yunying' || technologyPointList.length > 0"></el-input>
								</td>
								<td v-if="operateType == 'yunying'">
									<center>
										<el-button size="mini" type="text"
											@click="deletePoint('yunying',index)">删除</el-button>
									</center>
								</td>
							</tr>
						</table>
						<div class="row" style="overflow:hidden;height:70px;">
							<div v-if="operateType == 'yunying'">
								<el-button @click="addPoint('yunying')" type="primary" size="mini"
									style="float:right;margin-top:20px;"
									v-if="operateType == 'yunying'">添加功能点</el-button>
								<el-upload :action="fileUrl" :headers="fileHeaders" :show-file-list="false"
									:file-list="fileList"
									:on-success="(res, file, fileList) => handleAvatarSuccess(res, file, fileList, 'BUSINESS')"
									:on-error="handleAvatarError" multiple :limit="10000">
									<el-button type="primary" size="mini" style="margin:20px 0px;">新建文档</el-button>
								</el-upload>
							</div>
						</div>
						<div class="row">
							<el-table v-loading="loading" :data="busunessFileList" class="fileList"
								style="margin:0px;padding:0px;width:100% !important;">
								<el-table-column label="文档名称" align="center" prop="fileName"
									fixed="left"></el-table-column>
								<el-table-column label="操作" align="center" width="150" fixed="right">
									<template slot-scope="scope">
										<el-button type="text" size="mini" class="editBtn"
											@click="downLoadProjectFile(scope.row)">
											下载
										</el-button>
										<el-button type="text" size="mini" class="deleteBtn"
											@click="deleteProjectFile(scope.row)">
											删除
										</el-button>
									</template>
								</el-table-column>
							</el-table>
						</div>
					</el-col>
					<el-col :span="2">
						<br>
					</el-col>
					<el-col :span="11">
						<table class="table">
							<tr>
								<td width="10%">序号</td>
								<td width="80%">技术反馈功能点</td>
								<!-- <td width="10%" v-if="operateType == 'technology'">操作</td> -->
							</tr>
							<tr v-for="(item,index) in technologyPointList">
								<td>
									{{index+1}}
								</td>
								<td style="padding:0px;">
									<el-input type="textarea" v-model="technologyPointList[index].projectFunc"
										placeholder="请对运营功能点反馈" :disabled="operateType != 'technology'"></el-input>
								</td>
								<!-- <td v-if="operateType == 'technology'">
									<el-button size="mini" type="text"
										@click="deletePoint('technology',index)">删除</el-button>
								</td> -->
							</tr>
						</table>
						<div class="row" style="overflow:hidden;height:70px;">
							<div v-if="operateType == 'technology'">
								<el-upload :action="fileUrl" :headers="fileHeaders" :show-file-list="false"
									:file-list="fileList"
									:on-success="(res, file, fileList) => handleAvatarSuccess(res, file, fileList, 'TECHNOLOGY')"
									:on-error="handleAvatarError" multiple :limit="10000">
									<el-button type="primary" size="mini" style="margin:20px 0px;">新建文档</el-button>
								</el-upload>
							</div>
						</div>
						<div class="row">
							<el-table v-loading="loading" :data="technologyFileList" class="fileList"
								style="margin:0px;padding:0px;width:100% !important;"
								v-if="operateType == 'technology'">
								<el-table-column label="文档名称" align="center" prop="fileName"
									fixed="left"></el-table-column>
								<el-table-column label="操作" align="center" width="150" fixed="right">
									<template slot-scope="scope">
										<el-button type="text" size="mini" class="editBtn"
											@click="downLoadProjectFile(scope.row)">
											下载
										</el-button>
										<el-button type="text" size="mini" class="deleteBtn"
											@click="deleteProjectFile(scope.row)">
											删除
										</el-button>
									</template>
								</el-table-column>
							</el-table>
						</div>
						<!-- <el-button @click="addPoint('technology')" type="primary" size="mini" style="float:right;margin-top:20px;"v-if="operateType == 'technology'">添加功能点</el-button> -->
					</el-col>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<!-- <el-button type="primary" style="float:left;" @click="yunyingSure"
					v-if="operateType == 'yunying'">运营确认</el-button>
				<el-button type="primary" style="float:left;" @click="technologySure"
					v-if="operateType == 'technology'">技术确认</el-button> -->
				<el-button type="primary" @click="savePoint">保存</el-button>
				<el-button @click="operateDialog = false">关 闭</el-button>
			</span>
		</el-dialog>
		<el-dialog :visible.sync="printDialog" title="工单打印">
			<el-form ref="printForm" :model="printForm" id="myHtmlElement">
				<table class="table printForm">
					<tr>
						<td colspan="4" class="title">
							<p>工品优采平台功能需求申请单</p>
							<p
								style="position:absolute;font-size:12px;font-weight:normal;right:20px;top:60px;line-height:0px;height:0px;width:100%;text-align:right;">
								文档编号:{{printForm.projectNo}}</p>
						</td>
					</tr>
					<tr>
						<td class="leftTitle">申请部门</td>
						<td colspan="3">电商事业部</td>
					</tr>
					<tr>
						<td class="leftTitle">申请时间</td>
						<td colspan="3">{{printForm.applyTime}}</td>
					</tr>
					<tr>
						<td class="leftTitle">工单类型</td>
						<td colspan="3">{{printForm.workOrderType}}</td>
					</tr>
					<tr>
						<td class="leftTitle">关联产品</td>
						<td colspan="3">{{printForm.productName}}</td>
					</tr>
					<tr>
						<td class="leftTitle">关联项目</td>
						<td colspan="3">{{printForm.projectName}}</td>
					</tr>
					<tr>
						<td class="leftTitle">功能需求描述</td>
						<td colspan="3" style="height:150px;">{{printForm.projectDesc}}</td>
					</tr>
					<tr>
						<td class="leftTitle">运营技术需求沟通</td>
						<td colspan="3" style="height:150px;padding:0px;">
							<table style="width:100%;height:100%;" class="compare table">
								<tr>
									<td>
										<p v-for="(item,index) in printForm.businessArr">
											{{index+1}}、{{item.projectFunc}}
										</p>
									</td>
									<td>
										<p v-for="(item,index) in printForm.technologyArr">
											{{index+1}}、{{item.projectFunc}}
										</p>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td class="leftTitle">技术实施方案</td>
						<td colspan="3" style="height:150px;line-height:20px;text-align:left;">
							<p v-for="(item,index) in printForm.technologyArr">{{index+1}}、{{item.projectFunc}}</p>
						</td>
					</tr>
					<tr>
						<td class="leftTitle">业务申请人</td>
						<td>{{printForm.projectCreateUserName}}</td>
						<td class="leftTitle">申请时间</td>
						<td>{{printForm.projectCreateTime}}</td>
					</tr>
					<tr>
						<td class="leftTitle">业务架构</td>
						<td>张勇</td>
						<td class="leftTitle">确认时间</td>
						<td>
							{{printForm.businessTime}}
						</td>
					</tr>
					<tr>
						<td class="leftTitle">技术架构</td>
						<td>张超</td>
						<td class="leftTitle">确认时间</td>
						<td>
							{{printForm.technologyTime}}
						</td>
					</tr>
					<tr>
						<td class="leftTitle">审批流程</td>
						<td colspan="3" style="padding:0px;">
							<table class="table printForm">
								<tr>
									<td>审批人</td>
									<td>意见</td>
									<td>审批时间</td>
								</tr>
								<tr v-for="item in nameList">
									<td>{{item.name}}</td>
									<td>{{item.status == 1?'同意':item.status == 2?'驳回':''}}<br>{{item.reason}}</td>
									<td>{{item.status == 1?item.createTime:item.status == 2?item.createTime:''}}</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="goPrint">打印</el-button>
				<el-button @click="printDialog = false">关 闭</el-button>
			</span>
		</el-dialog>
		<el-dialog :visible.sync="workDialog" title="工作记录">
			<el-form ref="programForm" :model="programForm" label-width="100px" :rules="rules">
				<el-form-item label="选择人员" prop="orderName">
					<el-date-picker v-model="timeModel" type="datetimerange" range-separator="至"
						start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd hh:mm:ss" size="small">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="工作内容" prop="workDetail">
					<el-input v-model="programForm.workDetail" placeholder="请输入工作内容"></el-input>
				</el-form-item>
				<el-form-item label="补充内容" prop="describe">
					<el-input type="textarea" v-model="programForm.describe" placeholder="请输入补充内容" maxlength="1000"
						show-word-limit></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="personDialog = false">关 闭</el-button>
			</span>
		</el-dialog>
		<el-dialog :visible.sync="activitiDialog" title="审批选择">
			<el-form ref="programForm" :model="programForm" label-width="100px" :rules="rules">
				<el-form-item label="选择审批流" prop="activitiId">
					<el-select filterable v-model="programForm.activitiId">
						<el-option v-for="item in activitiList" :value="item.id" :label="item.activitiName"></el-option>
					</el-select>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="sendActiviti">确 定</el-button>
				<el-button @click="activitiDialog = false">关 闭</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import printJS from 'print-js'

	// 上传文件
	import fileUpdata from '@/api/file.config'

	import {
		selProductList,
		selectDictionary,
		insertProject,
		selProjectList,
		updateProject,
		delProject,
		insertMission,
		insertFunc,
		selFunc,
		selectUser,
		selMission,

		insertProjectFile,
		selProjectFile,
		delProjectFile,
		selprojectUser,
		selWorkOrderPrint,
		selUserList,
		
		insertProjectLog,
		selProjectLog,
		selActivitiList,
		insertTask,
		selWorkOrderActivitiList
	} from '@/api/workOrder.js'
	export default {
		name: "program",
		// 页面数据
		data() {
			return {
				userId: localStorage.getItem("userId"),
				fileHeaders: fileUpdata.headers(),
				fileUrl: process.env.VUE_APP_BASE_API + `/vapi/file/uploadfile?objectName=workOrder`,
				fileInfo: '',
				fileList: [],
				activitiList:[],
				// 查询条件
				queryParams: {
					pageNum: 1, // 显示第一页数据
					pageSize: 10, //每页显示十条
					beginTime: "",
					endTime: "",
					projectStatus: "",
				},
				programForm: {
					programForm: '',
					code: '',
					describe: ''
				},
				detailForm: {
					programForm: '',
					code: '',
					describe: ''
				},
				printForm: [],
				printDict: {},
				operateForm: {},
				stateList: [],
				loading: false,
				activitiDialog:false,
				list: [],
				total: 0, // 一共多少条数据
				timeModel: [],
				productModel: false,
				detailModel: false,
				operateDialog: false,
				printDialog: false,
				workDialog: false,
				operateType: '',
				rules: {
					projectName: [{
						required: true,
						message: "请您输入项目名称",
						trigger: "blur"
					}],
					projectType: [{
						required: true,
						message: "请选择项目类型",
						trigger: "change"
					}],
					productNo: [{
						required: true,
						message: "请选择关联产品",
						trigger: "change"
					}],
					level: [{
						required: true,
						message: "请选择优先级",
						trigger: "change"
					}],
					adminUser: [{
						required: true,
						message: "请选择项目负责人",
						trigger: "change"
					}],
					
				},
				floorList: [{
						name: '功能点1',
						state: '功能点1',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-10-01 00:00:00', '2023-10-11 00:00:00']
					},
					{
						name: '功能点2',
						state: '功能点2',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-10-11 00:00:00', '2023-10-21 00:00:00']
					},
					{
						name: '功能点3',
						state: '功能点3',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-10-21 00:00:00', '2023-10-31 00:00:00']
					},
					{
						name: '功能点4',
						state: '功能点4',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-11-01 00:00:00', '2023-11-21 00:00:00']
					}
				],
				floorList2: [{
						name: '立项阶段',
						state: '立项阶段',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-10-01 00:00:00', '2023-10-11 00:00:00']
					},
					{
						name: '产品阶段',
						state: '产品阶段',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-10-11 00:00:00', '2023-10-21 00:00:00']
					},
					{
						name: '开发阶段',
						state: '开发阶段',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-10-21 00:00:00', '2023-10-31 00:00:00']
					},
					{
						name: '交付阶段',
						state: '交付阶段',
						manager: '李越',
						collaborator: ['李越'],
						timeModel: ['2023-11-01 00:00:00', '2023-11-21 00:00:00']
					}
				],
				tabPosition: "left",
				personDialog: false,
				documentDialog: false,
				technologyPointList: [],
				yunyingPointList: [],
				dealType: '',
				productList: [],
				projectTypeList: [],
				// 人员列表
				userList: [],
				//项目阶段列表
				technologyTimeList: [],
				// 项目人员列表
				projectUserList: [],
				// 项目状态列表
				stateList: [],
				busunessFileList: [],
				technologyFileList: [],
				code:'',
				projectLogList:[],
				activitiList2:[],
				nameList:[]
			};
		},
		// 初始化
		mounted() {
			this.selUserList();
			this.getStateList();
			this.getList();
			// 查询产品列表
			this.selProductList();
			this.selectUser('coder')
		},
		// 函数集合
		methods: {
			sendActiviti(){
				var that = this;
				that.$confirm('选择审批流?', '温馨提示', {
					confirmButtonText: '是',
					cancelButtonText: '否',
					type: 'warning'
				}).then(() => {
					insertTask({
						projectId:this.programForm.id,
						projectNo:this.programForm.projectNo,
						activitiId:this.programForm.activitiId,
						current:0
					}).then(res=>{
						if(res > 0){
							this.$message.success("发起成功");
							this.activitiDialog = false;
							this.getList();
						}else{
							this.$message.error("发起失败");
						}
					})
				}).catch(() => {
					this.$message.error("发起失败");
				})
			},
			sendApply(row){
				var that = this;
				this.activitiDialog = true;
				this.programForm = row;
				selActivitiList({
					del:"0"
				}).then(res=>{
					if(res.code == 200){
						this.activitiList = res.rows;
					}
				})
				
			},
			selUserList() {
				selUserList({
					id: localStorage.getItem("userId")
				}).then(res => {
					this.code = res.rows[0].code
				})
			},
			getStateList() {
				var that = this;
				selectDictionary({
					dictType: "project_status"
				}).then(res => {
					that.stateList = res;
				})
			},
			// 查询项目文档
			selProjectFile(t) {
				var that = this;
				selProjectFile({
					projectNo: that.programForm.projectNo,
					fileType: t
				}).then(res => {
					if (t == 'BUSINESS') {
						that.busunessFileList = res.rows;
					} else if(t == 'TECHNOLOGY'){
						that.technologyFileList = res.rows;
					} else {
						that.fileList = res.rows;
					}
				})
			},
			// 下载文件
			downLoadProjectFile(row) {
				this.getBlob(row.filePath, (blob) => {
					this.saveAs(blob, row.fileName)
				})
			},
			downLoadProjectFile2(fileName, filePath) {
				this.getBlob(filePath, (blob) => {
					this.saveAs(blob, fileName)
				})
			},
			getBlob(url, cb) {
				var xhr = new XMLHttpRequest;
				xhr.open('GET', url, true);
				xhr.responseType = 'blob';
				xhr.onload = function() {
					if (xhr.status == 200) {
						cb(xhr.response)
					}
				}
				xhr.send();
			},
			saveAs(blob, fileName) {
				if (window.navigator.msSaveOrOpenBlob) {
					navigator.msSaveBlob(blob, fileName)
				} else {
					const link = document.createElement('a')
					const body = document.querySelector('body')
					link.href = window.URL.createObjectURL(blob)
					link.download = fileName
					link.style.display = 'none'
					body.appendChild(link)
					link.click()
					body.removeChild(link)
					window.URL.revokeObjectURL(link.href)
				}
			},
			// 删除文件
			deleteProjectFile(row) {
				var that = this;
				debugger
				that.$confirm('是否删除项目文档?', '温馨提示', {
					confirmButtonText: '是',
					cancelButtonText: '否',
					type: 'warning'
				}).then(() => {
					delProjectFile({
						id: row.id
					}).then(res => {
						if (res == 1) {
							that.$message.success("文档删除成功")
							that.selProjectFile();
							that.selProjectFile(row.fileType);
						} else {
							that.$message.error("文档删除失败")
						}
					}).catch(err => {
						that.$message.error("文档删除失败")
					})
				}).catch(() => {

				})

			},
			handleExceed(files, fileList) {
				this.$message.warning(`最多可上传 1 个附件，您已超限`)
			},
			handleAvatarSuccess(res, file, fileList, type) {
				var that = this;
				that.fileInfo = file;
				// that.fileList.push(file)
				// 在这里已经上传了，执行插入文档操作
				insertProjectFile({
					projectNo: that.programForm.projectNo,
					filePath: res.data,
					fileName: file.name,
					fileType: type
				}).then(res => {
					if (res == 1) {
						debugger
						if(type == 'DOC'){
							that.selProjectFile();
						}else if(type == 'TECHNOLOGY' || type == 'BUSINESS'){
							that.selProjectFile(type);
						}
						that.$message.success("文档上传成功")
					}
				})
			},
			handleAvatarError(res, file) {
				this.$message.error("文件上传失败，请重试")
			},
			//tab点击
			tabClicks(tab, event) {
				var that = this;
				that.selectUser();
				switch (tab.index) {
					case "0":
						that.selProjectPerson();
						break
					case "1":
						that.selMission();
						break
					case "2":
						that.selProjectFile();
						break
					case "3":
						that.selProjectPerson();
						break
					case "4":
						that.selProjectLog();
						break
					default:
						break
				}
			},
			selProjectLog(){
				var that = this
				selProjectLog({
					projectNo: that.detailForm.projectNo
				}).then(res => {
					that.projectLogList = res.rows;
				})
			},
			selProjectPerson() {
				var that = this
				selprojectUser({
					projectNo: that.detailForm.projectNo
				}).then(res => {
					that.projectUserList = res.rows;
				})
			},
			// 下载文件
			downLoadProjectFile(row) {
				this.getBlob(row.filePath, (blob) => {
					this.saveAs(blob, row.fileName)
				})
			},
			getBlob(url, cb) {
				var xhr = new XMLHttpRequest;
				xhr.open('GET', url, true);
				xhr.responseType = 'blob';
				xhr.onload = function() {
					if (xhr.status == 200) {
						cb(xhr.response)
					}
				}
				xhr.send();
			},
			saveAs(blob, fileName) {
				if (window.navigator.msSaveOrOpenBlob) {
					navigator.msSaveBlob(blob, fileName)
				} else {
					const link = document.createElement('a')
					const body = document.querySelector('body')
					link.href = window.URL.createObjectURL(blob)
					link.download = fileName
					link.style.display = 'none'
					body.appendChild(link)
					link.click()
					body.removeChild(link)
					window.URL.revokeObjectURL(link.href)
				}
			},
			// 删除文件

			// 提交验收工单
			CheckOrder(row, t) {
				var str = "";
				if(t == "CHECK"){
					str = "验收"
				}else{
					str = "等待验收"
				}
				this.$confirm('确认提交操作?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					updateProject({
						id: row.id,
						projectStatus: t,
						detail:str,
						projectNo:row.projectNo
					}).then(res => {
						if (res == 1) {
							this.$message.success("项目更新成功");
							this.getList();
							this.productModel = false;
						} else {
							this.$message.success("项目更新失败");
						}
					})
				}).catch(() => {

				})
			},
			addPoint(t) {
				var that = this;
				if (t == 'yunying') {
					that.yunyingPointList.push({
						projectFunc: '',
						projectFuncType: 'BUSINESS'
					})
				} else if (t == 'technology') {
					that.technologyPointList.push({
						projectFunc: '',
						projectFuncType: 'TECHNOLOGY'
					})
				}
			},
			deletePoint(type, index) {
				if (type == 'yunying') {
					this.yunyingPointList.splice(index, 1)
				} else if (type == 'technology') {
					this.technologyPointList.splice(index, 1)
				}
			},
			//运营确认
			yunyingSure() {
				this.$confirm('是否对技术描述认同?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {

				}).catch(() => {

				})
			},
			technologySure() {
				this.$confirm('是否确认技术与运营功能点一致?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {

				}).catch(() => {

				})
			},
			savePoint() {
				var that = this;
				if (that.operateType == 'yunying') {
					if (this.programForm.projectStatus == '业务功能点梳理' || this.programForm.projectStatus == '技术回复业务功能点') {
						return this.operateDialog = false;
					}
					if (this.yunyingPointList.length <= 0) {
						return this.$message.error("请输入功能点");
					} else {
						for (var i = 0; i < this.yunyingPointList.length; i++) {
							if (this.yunyingPointList[i].projectFunc == '') {
								return this.$message.error("请输入功能点");
							}
						}
					}
				}
				if (that.operateType == 'technology') {
					if (this.programForm.projectStatus == '技术回复业务功能点') {
						return this.operateDialog = false;
					} else {
						for (var i = 0; i < this.technologyPointList.length; i++) {
							if (this.technologyPointList[i].projectFunc == '') {
								return this.$message.error("请输入功能点");
							}
						}
					}
					if (this.technologyPointList.length <= 0) {
						return this.$message.error("请输入功能点");
					}
				}
				this.$confirm('确认保存功能点梳理内容?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					// programForm
					var list = [];
					if (that.operateType == 'yunying') {
						// yunyingPointList
						for (var i = 0; i < that.yunyingPointList.length; i++) {
							that.yunyingPointList[i].projectFuncType = 'BUSINESS';
							that.yunyingPointList[i].projectNo = that.programForm.projectNo;
							that.yunyingPointList[i].projectFunc = that.yunyingPointList[i].projectFunc;
							that.yunyingPointList[i].order = '';
							that.yunyingPointList[i].pid = '';
							that.yunyingPointList[i].id = that.programForm.id;
						}
						list = that.yunyingPointList;
						if (this.programForm.projectStatus == '业务功能点梳理') {
							this.operateDialog = false;
							return;
						}
					} else if (that.operateType == 'technology') {
						// technologyPointList
						for (var i = 0; i < that.technologyPointList.length; i++) {
							that.technologyPointList[i].projectFuncType = 'TECHNOLOGY';
							that.technologyPointList[i].projectNo = that.programForm.projectNo;
							that.technologyPointList[i].projectFunc = that.technologyPointList[i].projectFunc;
							that.technologyPointList[i].order = '';
							that.technologyPointList[i].pid = that.yunyingPointList[i].id;
							that.technologyPointList[i].id = that.programForm.id;
						}
						list = that.technologyPointList;
						// if(this.programForm.projectStatus == '技术回复业务功能点'){
						// 	this.operateDialog = false;
						// 	return;
						// }
					}
					insertFunc([
						...list
					]).then(res => {
						if (res > 0) {
							this.getList();
							this.$message.success("添加成功")
							this.operateDialog = false;
						} else {
							this.$message.success("添加失败")
						}
					})
				}).catch(() => {
					this.$message.success("添加失败")
				})
			},
			// 修改共组记录
			editWorkTime() {
				this.workDialog = true;
			},
			//打印
			goPrint() {
				printJS({
					printable: 'myHtmlElement',
					documentTitle:'工单系统',
					type: 'html',
					maxWidth: '1360',
					targetStyles: ['*']
				})
			},
			// 打印弹窗
			print(row) {
				var that = this;
				that.printForm = {};
				that.nameList = [];
				selWorkOrderPrint({
					projectNo: row.projectNo
				}).then(res => {
					var businessArr = [];
					var technologyArr = [];
					for (var i = 0; i < res.rows.length; i++) {
						if (res.rows[i].projectType == 'BUSINESS') {
							businessArr.push(res.rows[i])
						} else if (res.rows[i].projectType == 'TECHNOLOGY') {
							technologyArr.push(res.rows[i])
						}
					}
					var info = {
						applyTime: res.rows[0].applyTime,
						workOrderType: res.rows[0].workOrderType,
						productName: res.rows[0].productName,
						projectDesc: res.rows[0].projectDesc,
						projectName: res.rows[0].projectName,
						projectCreateUserName: res.rows[0].projectCreateUserName,
						projectCreateTime: res.rows[0].projectCreateTime,
						projectNo: row.projectNo,
						businessArr: businessArr,
						technologyArr: technologyArr,
						businessTime: businessArr[0].funcTime,
						technologyTime: technologyArr[0].funcTime,
					}
					that.printForm = info;
					that.printDialog = true;
				})
				
				
				selWorkOrderActivitiList({
					projectNo:row.projectNo
				}).then(res=>{
					if(res.code == 200){
						//已办数据
						var arr = res.rows;
						//审批层级列表
						var nameList = res.rows[0].userName.split(",");
						var newArr = [];
						for (var i = 0; i < nameList.length; i++) {
							newArr.push({
								name:nameList[i]
							})
						}
						for (var i = 0; i < newArr.length; i++) {
							//到当前节点了
							for (var j = 0; j < arr.length; j++) {
								if(newArr[i].name == arr[j].createUserName){
									newArr[i]['status'] = arr[i].status
									newArr[i]['createTime'] = arr[i].createTime
									newArr[i]['reason'] = arr[i].reason
								}
							}
						}
						that.nameList = newArr;
					}
				})
				this.printDialog = true;
			},
			// 运营弹窗
			operate(row, type) {
				this.programForm = row;
				this.operateType = type;
				this.operateDialog = true;
				this.selProjectFile("TECHNOLOGY");
				this.selProjectFile("BUSINESS");
				this.getFunc();
			},
			// 查询功能点
			getFunc() {
				var that = this;
				selFunc({
					pageNum: 1,
					pageSize: 1000,
					projectFuncType: 'BUSINESS',
					projectNo: that.programForm.projectNo
				}).then(res2 => {
					that.yunyingPointList = res2.rows;
					
					
					selFunc({
						pageNum: 1,
						pageSize: 1000,
						projectFuncType: 'TECHNOLOGY',
						projectNo: that.programForm.projectNo
					}).then(res => {
						if (res.rows.length == 0) {
							that.technologyPointList = [];
							for (var i = 0; i < that.yunyingPointList.length; i++) {
								that.technologyPointList.push({});
							}
						} else {
							that.technologyPointList = res.rows;
						}
						that.technologyTimeList = that.technologyPointList;
					})
					
				})

				
			},
			// 新增文档
			addDocument() {
				this.documentDialog = true;
			},
			// 新增人员
			addPerson() {
				this.personDialog = true;
			},
			// 删除行
			deleteRow(index) {
				this.floorList.splice(index, 1);
			},
			// 新增行
			addRow() {
				this.floorList.push({
					user: '',
					users: '',
					timeModel: '',
					collaborator: ''
				});
			},
			//编辑项目
			editProduct(row, t) {
				var type = "";
				if (t == 1) {
					// 技术转化工单
					this.programForm = row;
					//分配任务查询任务列表
					this.getFunc();
					type = "change";
				} else if (row && row.id) {
					// 修改
					this.programForm = row;
					type = "edit";
				} else {
					// 新增
					type = "add";
					this.technologyTimeList = [];
					this.programForm = {};
				}
				// 查询产品列表
				this.selProductList();
				// 查询项目类型
				this.selectDictionary('project_type');
				// 查询人员列表
				// this.selectUser();
				//查询项目阶段
				if (row.projectStatus == '技术分配任务') {
					// 查询人员列表
					this.selectUser('coder');
					this.selMission();
				} else if (row.projectStatus == 'SPLIT_TECHNOLOGY') {
					this.selectUser('coder');
				}
				// 查询项目文档
				// this.selProjectFile();
				this.dealType = type;
				this.productModel = true;
			},
			// 查询人员列表
			selectUser(t) {
				var that = this;
				selectUser({
					code: t
				}).then(res => {
					that.userList = res.rows;
				})
			},
			//查询项目类型
			selectDictionary(type) {
				var that = this;
				selectDictionary({
					dictType: type
				}).then(res => {
					that.projectTypeList = res;
				})
			},
			//查询项目阶段
			selMission() {
				var that = this;
				debugger
				selMission({
					pageNum: 1,
					pageSize: 1000,
					projectNo: that.detailForm.projectNo,
					types:'all'
				}).then(res => {
					res.rows.forEach(item => {
						item.state = item.funcId;
						item.timeModel = [item.startTime, item.endTime]
					})
					that.technologyTimeList = res.rows
					console.log(res.rows);
				})
			},
			// 查询产品列表
			selProductList() {
				var that = this;
				selProductList({
					pageNum: 1,
					pageSize: 1000
				}).then(res => {
					that.productList = res.rows
					console.log(res.rows);
				})
			},
			// 查看项目详情
			lookProduct(row) {
				var that = this;
				that.detailForm = row;
				that.programForm.projectNo = that.detailForm.projectNo
				that.detailModel = true;
				that.selectUser();
				that.selMission();
			},
			// 删除项目列表
			deleteProduct(row) {
				var that = this;
				this.$confirm('是否删除该条项目?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					delProject({
						id: row.id
					}).then(res => {
						if (res > 0) {
							that.$message.success("删除成功");
							that.getList()
						} else {
							that.$message.error("删除失败");
						}
					})
				}).catch(() => {
					that.$message.error("删除失败");
				})
			},
			//提交项目
			submitProduct() {
				var that = this;
				this.$refs["programForm"].validate((valid) => {
					if (valid) {
						if(!this.programForm.projectName){
							return this.$message.error("请输入项目名称");
						}else if(!this.programForm.projectType){
							return this.$message.error("请选择项目类型");
						}else if(!this.programForm.productNo){
							return this.$message.error("请选择关联产品");
						}else if(!this.programForm.level){
							return this.$message.error("请选择优先级");
						}
						if (that.technologyTimeList.length > 0) {
							for (var i = 0; i < that.technologyTimeList.length; i++) {
								if (!that.technologyTimeList[i].timeModel) {
									return this.$message.error("请选择周期");
								}
								if (that.technologyTimeList[i].collaborator.length <= 0) {
									return this.$message.error("请选择项目成员");
								}
								if (!that.technologyTimeList[i].adminUser) {
									return this.$message.error("请选择负责人");
								}
								if (!that.programForm.adminUser) {
									return this.$message.error("请选择负责人");
								}
								if (that.technologyTimeList[i].timeModel && that.technologyTimeList[i].timeModel
									.length == 2) {
									that.technologyPointList[i].startTime = that.technologyTimeList[i].timeModel[
										0];
									that.technologyPointList[i].endTime = that.technologyTimeList[i].timeModel[1];
								}
								that.technologyPointList[i].funcId = that.technologyTimeList[i].id;
								that.technologyPointList[i].missionState = "CREATE";
								that.technologyPointList[i].projectNo = this.programForm.projectNo;
							}
							// 更新项目阶段
							insertMission([
								...that.technologyTimeList
							]).then(res => {
								if (res > 0) {
									this.$message.success("项目新增成功");
									this.getList();
									this.productModel = false;
								} else {
									this.$message.success("项目新增失败");
								}
							})
						} else if (this.programForm.id) {
							// 修改
							updateProject({
								...this.programForm
							}).then(res => {
								if (res == 1) {
									this.$message.success("项目更新成功");
									this.getList();
									this.productModel = false;
								} else {
									this.$message.success("项目更新失败");
								}
							})
						} else {
							insertProject({
								...this.programForm
							}).then(res => {
								if (res == 1) {
									this.$message.success("项目新增成功");
									this.getList();
									this.productModel = false;
									// this.insertProjectLog(res);
								} else {
									this.$message.success("项目新增失败");
								}
							})
						}
					}
				});
			},
			// insertProjectLog(result){
			// 	insertProjectLog({
			// 		projectNo:result.projectNo,
			// 		detail:"项目新增"
			// 	}).then(res=>{
			// 		debugger
			// 	})
			// },
			//接口查询项目列表
			getList() {
				this.loading = true;
				if (this.timeModel.length > 0) {
					this.queryParams.startTime = this.timeModel[0];
					this.queryParams.endTime = this.timeModel[1];
				}
				selProjectList({
					...this.queryParams
				}).then(res => {
					this.list = res.rows
					this.total = res.total
					this.loading = false;
				})
				this.selUserList();
			},
			// 重置表单
			reset() {
				this.queryParams = {
					pageNum: 1,
					pageSize: 10,
					beginTime: "",
					endTime: "",
					projectStatus: ""
				}
			},

		}
	}
</script>
<style scoped lang='scss'>
	.editBtn span {
		color: red;
	}

	.deleteBtn span {
		color: red;
	}

	.detailBtn span {
		color: red;
	}

	.table {
		width: 100%;
		table-layout: fixed;
		border-collapse: collapse;
		border-style: solid;
		border-width: 1px;
		border-color: #d1d1d1;
	}

	.table td {
		border-style: solid;
		border-width: 1px;
		border-color: #d1d1d1;
		padding: 0 10px;
	}

	.el-date-editor.el-input,
	.el-date-editor.el-input__inner {
		width: 100%;
	}

	.printForm {
		.title {
			font-size: 20px;
			font-weight: bold;
			line-height: 80px;
			position: relative;
		}

		td {
			line-height: 60px;
		}

		.leftTitle {
			font-weight: bold;
		}
	}

	.compare {
		td {
			line-height: 20px;
			text-align: left;
		}
	}

	::v-deep .pointForm .el-textarea__inner {
		border: none !important;
	}

	::v-deep .fileList thead .el-table__cell {
		padding: 0px;
	}
</style>